<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--NewsScroller [INIZIO]-->
<script src="js/domnews.js"></script>
<link rel="stylesheet" href="css/domnews.css" media="screen"/>
<!--NewsScroller [FINE]-->
<?php
$str = 'domenico';

if (md5($str) === '1f3870be274f6c49b3e31a0c6728957f') {
    echo "Pillola rossa o pillola blu?";
}
else {
	echo md5($str) . "<br>";
}

try
    {
    $dsn = "sqlite:dbdir/database.sqlite";
    $username = "";
    $pass = "";

    $PDO = New PDO($dsn, $username, $pass);
    }
catch (PDOException $e) {
    die('Connessione fallita: ' . $e->getMessage());
    }

// settiamo il gestore degli errori
$PDO->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$newsmail = $_POST['newsmail'];
$newsmail = 'guarnacciad@yahoo.it';
$ip = $_SERVER['REMOTE_ADDR'];
$data = $_SERVER['REQUEST_TIME'];

echo "<html><body>";
echo $ip . "<br>";
echo $data . "<br>";

try{
    // commettiamo un errore SQL
    //$PDO->query("SELECT * FROM login_t");
    $sql_check = "SELECT COUNT(*) FROM newsletter_t where email = '" . $newsmail ."'";
    $sql_verifica = $PDO->query($sql_check);
    //echo 'Count rows selected: ' . $sql_verifica->fetchColumn();
    $verifica = $sql_verifica->fetchColumn();
    echo $verifica;
    }
catch(PDOException $e){
    // otteniamo l'errore
    echo 'Error: ' . $e->getMessage() . "<br>";
    echo 'Line: ' . $e->getLine() . "<br>";
    echo 'File: ' . $e->getFile() . "<br>";
    }

if ($verifica == '0') {
  echo "OK";
} else {
  echo "KO";
  }

echo "</body></html>";

	/*phpinfo();
 */
?>
      <center>
      <!--news-->
      <?php include("news.php"); ?>
      </center>
